import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 随访发起答题记录信息 */
export interface FollowUpQuestionRecord {
          id: number; // 答题记录ID
          recordId?: number; // 随访记录ID
          userId?: number; // 用户ID
          questionId?: number; // 随访问题ID
          title?: string; // 标题
          tip: string; // 提示语
          type?: boolean; // 题型（0单选 1多选 2填空 3问答 4日期）
          options: string; // 题目选项
          answer: string; // 用户答案
  }

// 随访发起答题记录 API
export const FollowUpQuestionRecordApi = {
  // 查询随访发起答题记录分页
  getFollowUpQuestionRecordPage: async (params: any) => {
    return await request.get({ url: `/business/follow-up-question-record/page`, params })
  },

  // 查询随访发起答题记录详情
  getFollowUpQuestionRecord: async (id: number) => {
    return await request.get({ url: `/business/follow-up-question-record/get?id=` + id })
  },

  // 新增随访发起答题记录
  createFollowUpQuestionRecord: async (data: FollowUpQuestionRecord) => {
    return await request.post({ url: `/business/follow-up-question-record/create`, data })
  },

  // 修改随访发起答题记录
  updateFollowUpQuestionRecord: async (data: FollowUpQuestionRecord) => {
    return await request.put({ url: `/business/follow-up-question-record/update`, data })
  },

  // 删除随访发起答题记录
  deleteFollowUpQuestionRecord: async (id: number) => {
    return await request.delete({ url: `/business/follow-up-question-record/delete?id=` + id })
  },

  /** 批量删除随访发起答题记录 */
  deleteFollowUpQuestionRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/business/follow-up-question-record/delete-list?ids=${ids.join(',')}` })
  },

  // 导出随访发起答题记录 Excel
  exportFollowUpQuestionRecord: async (params) => {
    return await request.download({ url: `/business/follow-up-question-record/export-excel`, params })
  },
}